package sound;

import logic.nodes.collision.CollidableNode;

public class AccelerateController extends SoundContinueController {
	
	private static final long serialVersionUID = 1L;
	
	private CollidableNode node;
	private MovingSoundController msController;
	
	public AccelerateController(String firstFile, String secondFile, CollidableNode node) {
		super(firstFile, secondFile);
		this.node = node;
	}
	
	@Override
	public void init() {
		super.init();
		msController = new MovingSoundController(node, firstSourceName);
	}
	
	@Override
	protected String playFirstFile() {
		return AudioManager.get().playSound(firstFile, node.getLocalTranslation());
	}
	
	@Override
	protected String playSecondFile() {
		node.removeController(msController);
		String secoundSource = AudioManager.get().playSound(secondFile, node.getLocalTranslation());
		msController = new MovingSoundController(node, secoundSource);
		return secoundSource;
	}
}